indenter
A few wrappers for the fmt::Write
objects that efficiently appends and remove
common indentation after every newline
Setup
Add this to your Cargo.toml
:
[]
= "0.2"
Examples
Indentation only
This type is intended primarily for writing error reporters that gracefully format error messages that span multiple lines.
use Error;
use ;
use indented;
;
"Dedenting" (removing common leading indendation)
This type is intended primarily for formatting source code. For example, when generating code.
This type requires the feature std
.
use Error;
use ;
use CodeFormatter;
let mut output = String new;
let mut f = new;
write!;
assert_eq!;
let mut output = String new;
let mut f = new;
// it can also indent...
f.indent;
write!;
assert_eq!;